import pandas as pd

df = pd.DataFrame({
    'name': ['张三', '李四', '王五'],
    'age': [21, 25, 30],
    'sex': ['男', '男', '女']
})

# 把DataFrame序列化成一个CSV文件
df.to_csv('data.csv', index=False)

# 把CSV文件反序列化成一个DataFrame
new_df = pd.read_csv('data.csv')
print(type(new_df))
print(new_df)
print(new_df.columns)
print(new_df.values)

dic = {key: val.values for key, val in new_df.T.items()}
for key, val in dic.items():
    print(key, end=': ')
    print(val)